package com.example.capsule_kafka.mapper;


import com.example.capsule_kafka.bean.UserToImeiBean;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @Author: zhuzhiming
 * @Date: 2022/4/28 12:05
 */
public interface UserToImeiBeanMapper extends JpaRepository<UserToImeiBean, Integer> {

    @Query(value = "select * from user_to_imei where user_to_imei.imei = ?1", nativeQuery = true)
    List<UserToImeiBean> getUserByMesi(String imei);

    @Query(value = "select max(id) from user_to_imei", nativeQuery = true)
    int getMaxId();

    @Query(value = "select user_id from user_to_imei where imei = ?1", nativeQuery = true)
    String getUserIdByImei(String imei);
}
